home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-19 | 1.3 KB | 50 lines | [TEXT/PJMM] |
- {******************************}
- {********* SAT Collision ][ **********}
- {******************************}
-
- {A more advanced version of SAT Collision, demonstrating the use of callback routines}
- {(hit task) for collision handling. What has happened is that the apples switch between}
- {good and bad, and we are not supposed to eat it when it's bad.}
-
- program SATcollisionII;
-
- uses
- SAT, sMrEgghead, sApple;
-
- var
- gameWind: WindowPtr;
- ignoreSp: SpritePtr;
- l: longint;
- p: Point;
- begin
- {Standard Inits are done by Think Pascal.}
-
- ConfigureSAT(true, VPositionSort, BackwardCollision, 32);
- gameWind := InitSAT(128, 129, 512, 322);
-
- initMrEgghead;
- initApple;
-
- ShowWindow(gameWind);
- SelectWindow(gameWind);
- PeekOffscreen;
-
- GetMouse(p);
- ignoreSp := NewSprite(0, p.h, p.v, @HandleMrEgghead, @SetupMrEgghead, @HitMrEgghead);
- ignoreSp := NewSprite(0, 0, Rand(offSizeV - 32), @HandleApple, @SetupApple, @HitApple);
-
- {SATSoundOff;}
- HideCursor;
-
- repeat
- l := TickCount;
- RunSAT(true);
- {Start a new sprite once in a while.}
- if Rand(40) = 1 then
- ignoreSp := NewSprite(0, 0, Rand(offSizeV - 32), @HandleApple, @SetupApple, @HitApple);
- while l > TickCount - 2 do {Maximize speed to 30 fps}
- ;
- until Button;
- ShowCursor;
- SATSoundShutUp; {Always make sure the sound channel is de-allocated!}
- end.